<script setup lang="ts">
interface Props {
  showBack: boolean
}

defineProps<Props>()

const emit = defineEmits<{
  back: []
}>()
</script>

<template>
  <header class="header">
    <div class="container">
      <div class="logo">
        <h1>Jupiter Blog</h1>
      </div>
      <nav class="nav">
        <button v-if="showBack" @click="emit('back')" class="back-btn">
          ← 返回列表
        </button>
        <div v-else class="nav-links">
          <a href="#" class="nav-link">首页</a>
          <a href="#" class="nav-link">分类</a>
          <a href="#" class="nav-link">关于</a>
        </div>
      </nav>
    </div>
  </header>
</template>

<style scoped>
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo h1 {
  margin: 0;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  align-items: center;
}

.back-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s;
}

.back-btn:hover {
  transform: translateY(-1px);
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: #666;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #667eea;
}

@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .nav-links {
    gap: 16px;
  }
  
  .nav-link {
    font-size: 14px;
  }
}
</style>
